# -*- coding: utf-8 -*-(for Scipe)

DEF $Left  $Right    #al2 = control of 2 ailerons  parameters= output channel Left / Right

# input variables are ail prof courb brake

#_________wing control surfaces
#   ailerons AL1 AL2
#   flaps    VL1 VL2
#   tail     Xtail  Vtail  Dtail (delta)$#_______adjustable Servo end points and center_________________________________________________________
# prefix = standardized names  prof rud ailL ailR... 
# suffix L=Left / R=Right or U=Up D=Down C =center

#________split ailerons, with differential (up/down needed to get a no-diff)
# differential with compensation of the hardware assymetry
ail.up:		INIT 100
ail.down:	INIT 70  # 100% each side = no differential only if the geometry of the servo command is symmetrical
ailR    SUBAS ail  ail.down:   ail.up:  #aileron right  +=down -=up $diff
ailL    ADDAS ail  ail.up:    ail.down:    #aileron left,+=down -=up

#________aileron:  combines several symmetrical actions into the temporary variable ailsym 
prof.ail:      INIT 0 # snap flap -> ailerons here the normal prof <0 = pull
prof.ail.down: INIT 0 #push
ailsym    ADDAS	prof   prof.ail: prof.ail.down:
courb.ail.D: INIT 0 #camber
courb.ail.U: INIT 0 #camber
ailsym	ADDAS	courb  courb.ail.D:  courb.ail.U: 
brake.ail: INIT 0 #butterfly
ailsym    ADDS    brake    brake.ail:
#split -> ail Left and ail Right
ailL    ADD ailL ailsym
ailR  ADD ailR ailsym
#______servo travel
ailL.U: INIT 100.00
ailL.C: INIT 0.00
ailL.D: INIT -100.00
ailL.s	SERV ailL ailL.D: ailL.C: ailL.U:
ailR.U: INIT 100.00
ailR.C: INIT 0.00
ailR.D: INIT -100.00
ailR.s	SERV ailR ailR.D: ailR.C: ailR.U: 

@V$Left		OUTN ailL.s 	1.55 .55
@V$Right	OUTN ailR.s 	1.55 .55
